using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DWORD = System.UInt32;
using WORD = System.UInt16;
using SCORE = System.Int64;
using SCOREEX = System.Double;
using ZWFrameWork;
using Random = UnityEngine.Random;

public class GlobalUserItem : SingletonInstance<GlobalUserItem>
{
    /// <summary>
    /// BGMVolume
    /// </summary>
    public static float BGMVolume = 1f;

    /// <summary>
    /// EffectAudioVolume
    /// </summary>
    public static float EffectAudioVolume = 1f;

    /// <summary>
    /// musicSwitch
    /// </summary>
    private static bool musicSwitch = true;

    /// <summary>
    /// soundSwitch
    /// </summary>
    private static bool soundSwitch = true;
    
    //推广员大厅奖励通知弹窗,次数
    public static bool ReferEarnRewardFlag = false;
    
    public static int ReferEarnRewardNum = 0;

    public static bool ReferEarnOpenRecord = false;
    //邮件进入绑定手机
    public static bool MailEnterBindFlag = false;


    public static List<string> joinRoomList=new List<string>();

    public static string szRoomPasswd { get; set; }
    public static bool bindMobileFlag { get; set; }
    
    public static bool isDownloadGame { get; set; }
    public static WORD gameKindId { get; set; }
    public static string szSpreaderAccount { get; set; }
    public static string szQQNumber { get; set; }
    public static string szEmailAddress { get; set; }
    public static string szSeatPhone { get; set; }
    public static string szMobilePhone { get; set; }
    public static string szTrueName { get; set; }
    public static string szAddress { get; set; }
    public static string szPasswordID { get; set; }
    /// <summary>
    /// 钱包绑定的手机号
    /// </summary>
    public static string szWalletPhone { get; set; }

    public static long FirstWithDrawFlag { get; set; }
    public static UInt16 wFaceID { get; set; }
    public static byte cbGender { get; set; }
    public static UInt32 dwCustomID { get; set; }
    public static UInt32 dwUserID { get; set; }
    public static UInt32 dwGameID { get; set; }
    public static string szNickName { get; set; }
    public static string szDynamicPass { get; set; }
    public static bool isDownLoadGame{ get; set; }
    public static string szServerPasswd { get; set; }
    public static string szMachineID { get; set; }
    public static byte cbEnjoinYuEBao { get; set; }
    public static byte cbYuEBaoEnabled { get; set; }
    public static int cbIsNewUser { get; set; }
    public static double lWithDrawScore { get; set; }
    public static double lServiceFee { get; set; }
    public static double lRechargeAmount { get; set; }
    public static UInt32 dwLockServerID { get; set; }
    public static UInt32 dwLockKindID { get; set; }
    public static SCOREEX userScore { get; set; }
    public static double lUserScore { get; set; }
    public static double lUserBonus { get; set; }
    public static double dUserBeans { get; set; }
    public static double lUserInsure { get; set; }
    public static long lUserDiamond { get; set; }
    public static int lAwardTicket { get; set; }
    public static SCOREEX CoinBuyPropCount { get; set; }
    public static byte cbInsureEnabled { get; set; }
    public static byte cbIsAgent { get; set; }
    public static double lEnterScore { get; set; }
    public static double lMaxEnterScore { get; set; }
    public static DWORD dwServerRule { get; set; }
    public static bool bPrivateRoom { get; set; }
    public static string szSign { get; set; }
    public static byte cbMemberOrder { get; set; }
    public static uint nLargeTrumpetCount {get; set; }
    public static Dictionary<int, Texture2D> mAllHeadInfo = new Dictionary<int, Texture2D>();
    public static bool mBoolFirstOpenEnterLogin = true;//主要针对游戏第一次进入的时候需要登录进游戏，其他后面就不需要自动登录了
    public static int UpAccountNetBack = 0;//个人信息里的账号绑定之后返回
    public static string szMachine {
        get
        {
            string adjustid = "";
            if (PlayerPrefs.HasKey("AdjustId"+dwUserID))
            {
                adjustid = PlayerPrefs.GetString("AdjustId" + dwUserID);
            }
            else
            {
                adjustid = Random.Range(10000000000, 9999999999).ToString();
                PlayerPrefs.SetString("AdjustId"+dwUserID,adjustid);
            }

            return adjustid;
        }
        set { }
    }

    /// <summary>
    /// 现在选择的区号
    /// </summary>
    public static uint CurrentCountryNumber = 91;
    /// <summary>
    /// 存储区号的键值
    /// </summary>
    public static string CountryNumberPresKey = "CountryNumberPresKey";
    /// <summary>
    /// 默认区号
    /// </summary>
    public static uint defaultCountryCode = 91;

    public static int szLoginType = 0;

    public static string mPhoneKey = "AATTCCDDC";                 //--存储账户的键值
    public static string mPwdKey = "EEFFGGHHC";                   //--存储密码的键值
    public static string mRememberPwdKey = "CCJJKKLLK";           //--存储是否记住密码的键值
    public static int mLoginEndOptFormId = 0;
    public static string mPhoneNumber = null;                       //临时保留的账号信息 手机号码
    public static string LocalUpHeadTimeKey = "Local_Up_Head_Time_Key_String_uid"+dwUserID;

    //震动是否开启
    public static bool IsVibrateOpen = true;
    /// <summary>
    /// web支付的数据
    /// </summary>
    public static string PostEnvir = "https://front.apoiionnewgame.xyz";
    /// <summary>
    /// 测试web支付的数据
    /// </summary>
    //public static string PostEnvir = "https://front.superdreamfactorygame.online";

    /// <summary>
    /// 当前游戏的编号
    /// </summary>
    public static int KindID { get; set; }


    public static string szAccount { get; set; }
    

    public static long UserId = 0;
    public static string userName;

    private static long gold = 0;

    /// <summary>
    /// 获取充值了多少金额 总共
    /// </summary>
    /// <param name="set"></param>
    /// <param name="ischange"></param>
    /// <returns></returns>
    public static double OnGetRechargeAmount(double set = 0, bool ischange = false)
    {
        if (ischange)
        {
            lRechargeAmount = set;
        }
        else
        {
            lRechargeAmount = lRechargeAmount + set;
        }

        return lRechargeAmount;
    }
    //public static long Gold
    //{
    //    get { return gold; }
    //    set
    //    {
    //        gold = value;
    //        OnGlobleChanged?.Invoke();
    //    }
    //}
    //public static string headerUrl = "https://thirdwx.qlogo.cn/mmopen/vi_32/TUMmXsoASReVHAVFLIypibjJKPUE7BAjffbub1tYTaU6AFdCVbRdgnB7iaJMjpo3O1sWqaYZwJxMbct13eEEyumg/132";

    //public static UserState userState = UserState.Idle;
    //public static Action OnGlobleChanged;
    //public static F20003s2c signData;

    //public static int RewordVideoNum
    //{
    //    get { return PlayerPrefs.GetInt(Key.RewordNum, 0); }
    //    set
    //    {
    //        PlayerPrefs.SetInt(Key.RewordNum, value);
    //    }
    //}

    public static void OnSetUserScore(double score)
    {
        GlobalUserItem.lUserScore = score;
    }

    public void OnSetUserBonus(double bonus)
    {
        GlobalUserItem.lUserBonus = bonus;
    }

    public static void SetlUserTicket(int nAwardTicket)
    {
        lAwardTicket = nAwardTicket;
    }

    public static string FormatPhoneNumber(string str)
    {
        return "91-" + str;
    }


    public static string ExtensionRankingOpen = "Extension_Ranking_Day_Open_";
    
    
    /// <summary>
    /// 初始化数据
    /// </summary>
    public override void InitData()
    {
    }

    /// <summary>
    /// 清理数据
    /// </summary>
    public override void ClearData()
    {
    }
}